﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Xml;

public partial class RSS_ViewRss : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            StringBuilder render = new StringBuilder();
            XmlDocument doc = new XmlDocument();
            doc.Load("http://vnexpress.net/rss/gl/trang-chu.rss");
            XmlNodeList nodeList = doc.GetElementsByTagName("item");
            for (int i = 0; i < nodeList.Count; i++)
            {
                XmlNodeList nodeChildItem = nodeList.Item(i).SelectNodes("title");
                XmlNodeList nodeChildLink = nodeList.Item(i).SelectNodes("link");
                XmlNodeList nodeChildDate = nodeList.Item(i).SelectNodes("pubDate");
                XmlNodeList nodeChildDesciption = nodeList.Item(i).SelectNodes("description");
                string link = nodeChildLink.Item(0).InnerText;
                // render.Append("<br /><b><a href="+ link +" target='_blank'>" + nodeChildItem.Item(0).InnerText + "</a></b>");
                render.Append("<br /><b><a href='DetailVNExpress.aspx?link=" + link + "' target='_blank'>" + nodeChildItem.Item(0).InnerText + "</a></b>");
                render.Append("<br /><font color='gray'>" + nodeChildDate.Item(0).InnerText + "</font>");
                render.Append("<p>" + nodeChildDesciption.Item(0).InnerText + "<hr>");
            }
            VNExpress.InnerHtml = render.ToString();
        }

    }
}